package ar.edu.itba.it.poo

class Bank(val name: String) {
	var accounts = Set[Account]()

	def add(account: Account) { accounts += account }
	def remove(account: Account) {accounts -= account }
	def balance = accounts.view.map(_.founds).sum
	def totalAccounts = accounts.size
}

object BankTest extends Application {
	val bank = new Bank("Santander Rio")
	
	val account1 = new Account("1234/5", "Bob")
	bank.add(account1)
	
	val account2 = new Account("1234/5", "Alice")
	bank.add(account2)

	println(bank.totalAccounts);
	println(bank.balance);
	
	account1.credit(100);
	account2.credit(200);
	bank.remove(account2);
	println(bank.totalAccounts);
	println(bank.balance);
}